﻿@page "/forms/switching-components-does-not-bind"
@using Components.TestServer.RazorComponents
@using Microsoft.AspNetCore.Components.Authorization

<h2>Form component instance changes before dispatching</h2>

@if (!_ready)
{
    <ComponentWithFormInside>
    </ComponentWithFormInside>
}else
{
    <CascadingValue Value="new object()">
        <ComponentWithFormInside>
        </ComponentWithFormInside>
    </CascadingValue>
}

@code
{
    private bool _ready;
    protected override async Task OnInitializedAsync()
    {
        await Task.Yield();
        _ready = true;
    }
}
